<?php
/**
 * Created by PhpStorm.
 * User: 戎大富
 * Date: 2019/4/9
 * Time: 17:40
 * 商城统计
 */
namespace app\admin\controller;
use think\Db;
class Mall extends Base {

    public function index(){
        //盈利
        $where['order_status']= array('IN',array(2,3,4));
        $where['order_after']= array('<>',3);
        $yl = Db::table('up_order')->where($where)->sum('order_user_pay');
        $ylgold = Db::table('up_order')
            ->where($where)
            ->where('order_hh_payment','in','1,2')
            ->sum('order_glod');
        //有效订单  已确认收货的订单
        $where1['order_status']= array('IN',array(2,3,4));
        $where1['order_after']= ['IN', '1,2'];;
        $yxdd = Db::table('up_order')->where($where1)->count();
        //总订单数量
        $where2['order_status']= array('IN',array(2,3,4));
        $zdd = Db::table('up_order')->where($where2)->count();
        //售后订单
        $where3['order_after']= ['IN', '2,3'];
        $sh = Db::table('up_order')->where($where3)->count();
        //待发货订单
        $where4['order_status']= 2;
        $where4['order_after']= ['IN', '1,2'];;
        $dfh = Db::table('up_order')->where($where4)->count();
        //今日新增订单
        $time2 =  date('Y-m-d 23:59:59');
        $time1 =  date('Y-m-d 00:00:01');
        $where5['order_time'] = array('between',array($time1,$time2));
        $where5['order_status']= array('not in',array(1,5,6));
        $jrxz = Db::table('up_order')->where($where5)->count();
        $info['yl'] = $yl;
        $info['yxdd'] = $yxdd;
        $info['zdd'] = $zdd;
        $info['sh'] = $sh;
        $info['dfh'] = $dfh;
        $info['jrxz'] = $jrxz;
        $info['ylgold'] = $ylgold;
        $this->assign('info',$info);
        return $this->fetch();
    }
}
